=begin

This file is part of the RSIF project, http://rsif.googlecode.com

Copyright (c) 2009-2009 See AUTHORS

rsif is free software: you can redistribute it and/or modify
it under the terms of the gnu general public license as published by
the free software foundation, either version 3 of the license, or
(at your option) any later version.

rsif is distributed in the hope that it will be useful,
but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.  see the
gnu general public license for more details.

you should have received a copy of the gnu general public license
along with rsif.  if not, see <http://www.gnu.org/licenses/>.


=end
require "logger/rlogger"
require "logger/contextlogger"

module Rsif
	class RsifLoadError < Exception

		attr_reader	:path
		def initialize(path)
			@path = path
		end

		def to_s

			case path
				when /irb/
					"\nruby-irb not found installed in the system. 
Please follow the instructions manual properly ( http://code.google.com/p/rsif/wiki/ManualInstalacion )
on readhat based systems run 'yum install ruby-irb'
on debian based systems run 'apt-get install irb1.8'\n"
				else
				"no such file to load -- #{path}"
			end


			
		end

		def inspect
			to_s
		end
	end
end


include Rsif::Core::Logging
$original_require_method = Object.method(:require)
def require(path)
	logger.debug "calling require for path \"#{path}\"\n"

	begin
		$original_require_method.call(path)
	rescue LoadError
		raise Rsif::RsifLoadError.new(path)
	end
end


